home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Reference Manual / Prograph Reference 5-7 / Prograph Reference 5-7.rsrc / TEXT_153.txt < prev    next >
Encoding:
Text File  |  1995-10-25  |  9.0 KB  |  207 lines

  1.  
  2.  AppleTalk  *250*
  3.  
  4. Prograph's AppleTalk primitives provide a vastly simplified interface for accomplishing the most common network tasks - registering on the network, finding out what other nodes are out there on the network, and sending textual data between programs on the network. It is not necessary to read Inside Macintosh to use these primitives. 
  5.  
  6. A SPECIAL NOTE ABOUT ATP:  The AppleTalk Transaction Protocol is a protocol for delivering data between nodes on an AppleTalk network.  The AppleTalk Manager toolbox calls are described in Inside Macintosh . Detailed information about AppleTalk protocols is available in Inside AppleTalk.
  7.  
  8. Loading AppleTalk Primitives
  9.  
  10. AppleTalk primitives are stored in the Communication Primitives file, located in the Disabled Primitives folder, a subfolder in the Prograph Extensions folder.  These primitives are not initially loaded with Prograph Classic, as packaged.  
  11.  
  12. NOTE:  The Communication Primitives file also contains the Serial Port primitives.
  13. In order to use the AppleTalk primitives, shut down Prograph and move the  Communication Primitives file into the Prograph Extensions folder. You may have to increase Prograph's minimum memory allocation using Finder's Get Info dialog.  The AppleTalk primitives are enabled the next time you start Prograph.
  14.  
  15. Using AppleTalk Primitives  *250*
  16.  
  17. Network-aware programs are either clients, server programs, or both. All of these must call ATP-Open and NBP-Open sometime after starting up, and before using any other AppleTalk primitives. The next step is usually to call NBP-Register to make the program's name and type known to other programs on the network. Note that the program type can be any string you like. It allows you to later query the network to find out all programs of a certain type that are running on the network.
  18.  
  19. Once registered, server programs use ATP-Get-Request periodically (i.e. at idle time) to check for client-side requests being sent. When a request is received, the server uses ATP-Send-Response to reply to the client. On the other side, client programs wait for some user action or other event to precipitate sending a request to a server with ATP-Send-Request. After the request is sent, the client must check periodically for the server's response with ATP-Get-Response.
  20.  
  21. The contents of the request and response strings are entirely up to the client and server programs. Usually you would define your own ‚Äúcode words‚Äù for the requests and responses. If you are working with an existing server program, it should have documented which requests it understands, and the format of the responses.
  22.  
  23. AppleTalk Errors  *251*
  24.  
  25. Every AppleTalk primitive returns an integer error code. Zero means success; otherwise, an error has occurred. Error numbers may be one of those documented in Inside Macintosh, or one of the following:
  26.  
  27. Error Number Description 
  28.  
  29. 1    The AppleTalk protocol is already active    
  30. 2    Both NBP and ATP must be open    
  31. 3    The port is not configured for AppleTalk    
  32. 4    Unable to open AppleTalk because AppleTalk is inactive    
  33. 5    The Correct versions of the AppleTalk drivers are unavailable    
  34. 6    Unable to execute server only primitives from a client    
  35. 7    Unable to execute client only primitive from a server    
  36. 8    Unable to locate entity    
  37. 9    Unable to respond to the client    
  38. 10    Attempting to register on AppleTalk under more than one name    
  39. 11    Unknown error    
  40. 12    Memory error    
  41. 13    Entity not found    
  42.  
  43. _________________________________________________
  44. ¬†                        
  45.                                     ATP-Close     *251*
  46.  
  47.  
  48. Output types:  integer
  49.  
  50. Description:  Closes AppleTalk under ATP. If you have called ATP-Open, you must call ATP-Close before quitting your application.
  51.  
  52. See also: ATP-Open
  53.  
  54. _________________________________________________
  55.  
  56. ¬†                                           
  57.                                              ATP-Get-Request    *252*
  58.  
  59.  
  60.  
  61. Input type:     boolean
  62.  
  63. Output types:  list; string; integer
  64.  
  65. Description:  Used by server-side applications to check whether a request has been sent by a client. If AutoRespond is true, a response will automatically be sent, containing the default message ‚ÄúOKAY‚Äù. Sender is a list of three integers which identify the sender. This list should be passed into ATP-Send-Response. 
  66.  
  67. See also:  ATP-Send-Response
  68.  
  69. _________________________________________________
  70.  
  71.  
  72.                                                 ATP-Get-Response    *252*
  73.  
  74.  
  75. Output types:     list; string; integer
  76.  
  77. Description:     Used by client-side applications to check for a server's response after the client has sent a request. If no responses are available, Message and Sender are NULL. Otherwise, Sender is in the form of a list of three strings: (Name Type Zone).
  78.  
  79. See also:  ATP-Send-Request
  80.  
  81. _________________________________________________
  82.  
  83.  
  84.                                             ATP-Open     *252*
  85.  
  86.  
  87. Input types: string; boolean
  88.  
  89. Output types: integer
  90.  
  91. Description: Opens AppleTalk under ATP. Must be called before using any of the other ATP primitives. NodeType may be ‚Äúserver‚Äù, ‚Äúclient‚Äù or ‚Äúboth‚Äù. If SelfSend is TRUE, the node is able to send to itself.
  92.  
  93. See also: ATP-Close
  94.  
  95. _________________________________________________
  96.  
  97.  
  98.                                            ATP-Send-Request    *253*
  99.  
  100.  
  101. Input names:  Servers; Request; [Count; Interval]
  102.  
  103. Input types:     list of ( Name [Type [Zone]] ); string; [ integer; integer ]
  104.  
  105. Defaults: Count = 2; Interval = 8; Type = "=" (current type); Zone = "*" (all zones)
  106.  
  107. Output types: integer
  108.  
  109. Description:     Used by client-side applications to send a Request to a list of Servers. Each server identifier in the list is itself a list of one to three strings: (Name [Type [Zone]]). Use NBP-Lookup to obtain a list of which servers are available on the network. A value of ‚Äú*‚Äù for Type means the request will be sent to all registered applications; ‚Äú=‚Äù means it will be sent to applications with the same type as the sending application only. A value of ‚Äú*‚Äù for Zone means all zones; ‚Äú=‚Äù means the current zone only. Count is the number of retries. Interval is the number of seconds between retries.
  110.  
  111. See also:  ATP-Get-Response, NBP-Lookup
  112.  
  113. _________________________________________________
  114.  
  115.  
  116.                                            ATP-Send-Response    *253*
  117.  
  118.  
  119. Input names: Client; Response; [ Count; Interval ]
  120.  
  121. Input types: list of integer; string; [ integer; integer ]
  122.  
  123. Defaults:  Count = 2; Interval = 8
  124.  
  125. Output types: integer
  126.  
  127. Description: Used by a server-side application to send Response to Client. Client is the list of integers returned as the Sender by ATP-Get-Request. Count is the number of retries. Interval is the number of seconds between retries.
  128.  
  129. See also:  ATP-Get-Request
  130.  
  131. _________________________________________________
  132.  
  133.  
  134.                                      NBP-Close     *254*
  135.  
  136.  
  137. Output types: integer
  138.  
  139. Description:  Closes AppleTalk under NBP. If you previously called NBP-Open, you must call NBP-Close before quitting your application.
  140.  
  141. See also:  NBP-Open
  142.  
  143. _________________________________________________
  144.  
  145.  
  146.  
  147.                                   NBP-Confirm    *254*
  148.  
  149.  
  150. Input names:     Name; [ Type; Zone; Count; Interval ]
  151.  
  152. Input types:     string; [ string; string; integer; integer ]
  153.  
  154. Defaults: Type = "=" (current type); Zone = "*" (all zones); Count = 2; Interval = 8
  155.  
  156. Output types:  integer
  157.  
  158. Description: Confirms that a node is still on the network. Confirms the existence of Name of Type in Zone. Count is the number of retries. Interval is the number of seconds between retries. If node is confirmed, Error is 0; otherwise, Error is 13.
  159. See also:  NBP-Lookup
  160.  
  161. _________________________________________________
  162.  
  163.  
  164.                                  NBP-Lookup    *254*
  165.  
  166.  
  167. Input names:  [ Type; Zone; HowMany; Count; Interval ]
  168.  
  169. Input types: [ string; string; integer; integer; integer ]
  170.  
  171. Defaults: Type = "=" (current type); Zone = "*" (all zones); HowMany = 100; Count = 2; Interval = 8
  172.  
  173. Output types:     list; integer
  174.  
  175. Description:     Finds out what other entities are on the network. Finds a maximum of HowMany entities of type Type in zone Zone. Count is the number of retries. Interval is the number of seconds between retries. Names is a list of entities found; each entity takes the form of a list of strings( Name Type Zone ).
  176.  
  177. See also: NBP-Confirm
  178.  
  179. _________________________________________________
  180.  
  181.  
  182.                                NBP-Open     *255*
  183.  
  184.  
  185. Output type:     integer
  186.  
  187. Description: Opens AppleTalk under NBP. Must be called before using any of the other NBP primitives.
  188.  
  189. See also:  NBP-Close
  190.  
  191. _________________________________________________
  192.  
  193.  
  194.                                     NBP-Register    *255*
  195.  
  196.  
  197. Input names:     [ Name; Type; Count; Interval; Verify ]
  198.  
  199. Input types: [ string; string; integer; integer; boolean ]
  200.  
  201. Defaults: Name = User Name as entered in the Sharing Setup Control Panel; Type = ‚Äú=‚Äù; Zone = ‚Äú*‚Äù; Count = 2; Interval = 8; Verify = FALSE
  202.  
  203. Output types:     integer
  204.  
  205. Description:  Register the Name and Type on the AppleTalk network under NBP. Count is the number of retries. Interval is the number of seconds between retries. If Verify is TRUE, Name must be unique to the network.
  206. See also: NBP-Lookup
  207.